package com.example.healkep;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.example.healkep.adapter.bg.BasicFragmentAdapter;
import com.example.healkep.fragment.bg.FragmentDay;
import com.example.healkep.fragment.bg.FragmentMonth;
import com.example.healkep.fragment.bg.FragmentWeek;
import com.example.healkep.fragment.weight.FragmentRecomWeight;
import com.example.healkep.fragment.weight.FragmentViewWeight;
import com.google.android.material.tabs.TabLayout;

import java.util.ArrayList;
import java.util.List;

public class ViewWeight extends AppCompatActivity {
    private TabLayout tabLayout;
    private ViewPager viewPager;
    String[] titleArray = new String[]{"体重数据展示", "增长范围推荐"};


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view_weight);

        tabLayout = findViewById(R.id.tab_layout);
        viewPager = findViewById(R.id.view_pager);

        List<Fragment> fragmentList = new ArrayList<>();
        fragmentList.add(new FragmentViewWeight());
        fragmentList.add(new FragmentRecomWeight());

        BasicFragmentAdapter adapter = new BasicFragmentAdapter(getSupportFragmentManager(), fragmentList, titleArray);
        viewPager.setAdapter(adapter);
        tabLayout.setupWithViewPager(viewPager);
    }
}

